package org.example.netty.handler.message;

import org.example.netty.constant.MessageType;
import org.example.netty.model.ExtendedChannelContext;
import org.example.netty.model.CustomMessage;

/**
 * 未知消息类型处理
 */
public class UnknownMessageTypeHandler implements BusinessMessageTypeHandler{
    @Override
    public void handler(CustomMessage requestMessage, ExtendedChannelContext extendedChannelContext) {
        //构建响应消息包
        CustomMessage responseMessage = new CustomMessage(
                requestMessage.getMagic(),requestMessage.getVersion(),requestMessage.getSerializeAlgo(),
                requestMessage.getReserved(), MessageType.UNKNOWN,requestMessage.getRequestId(),
                0,new byte[]{});
        //todo 独特的消息处理

        //发送响应消息包
        extendedChannelContext.sendResponse(responseMessage);
    }
}
